package org.luxor.eshop.payment.service;

import org.luxor.commons.core.web.data.R;
import org.luxor.eshop.payment.entity.dto.OrderDto;
import org.luxor.eshop.payment.service.hystrix.OrderHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * 远程RPC调用账单服务
 *
 * @author Mr.Yan  @date: 2020/9/2
 */
@FeignClient(name = "luxor-example-seata-order", path = "order", fallback = OrderHystrixImpl.class)
public interface OrderFeign {

    /**
     * 获取订单
     *
     * @param orderId 订单号
     * @return 订单信息
     */
    @PostMapping("/get/{orderId}")
    R<OrderDto> get(@PathVariable("orderId") Long orderId);

    /**
     * 订单付款成功
     *
     * @param orderId 订单号
     * @return
     */
    @PostMapping("/paySuccess/{orderId}")
    R paySuccess(@PathVariable("orderId") Long orderId);

    /**
     * 订单付款失败
     *
     * @param orderId 订单号
     * @return
     */
    @PostMapping("/payFailed/{orderId}")
    R payFailed(@PathVariable("orderId") Long orderId);
}
